package com.ruoyi.forum.service.impl;

import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.forum.domain.vo.UpdatePassword;
import com.ruoyi.forum.mapper.ForumStudentMapper;
import com.ruoyi.forum.service.IForumLoginService;
import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.system.mapper.SysUserRoleMapper;
import com.ruoyi.system.service.ISysRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class ForumLoginServiceImpl implements IForumLoginService {

    @Autowired
    private ISysRoleService roleService;

//    @Autowired
//    private SysUserRoleMapper userRoleMapper;

    @Autowired
    private SysUserMapper userMapper;

//    @Autowired
//    private ForumStudentMapper forumStudentMapper;

    @Override
    public boolean isStudentRole(SysUser user) {
        return false;
    }

    @Override
    @Transactional
    public int updatePassword(UpdatePassword updatePassword) {
        SysUser user = userMapper.checkEmailUnique(updatePassword.getEmail());
        user.setPassword(updatePassword.getPassword());

        return userMapper.updateUser(user);
    }

}
